package com.itheima.exer.homework.hw1008;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class CountTest {
    private static final Map<String , Integer> map = new HashMap<>();
    public static void main(String[] args) {
        File file = new File("E:\\z实验文件夹\\a");
        String[] list = file.list();
        for (String s : list) {
            String[] split = s.split("\\.");
            if (map.containsKey(split[1])){
                map.put(split[1],map.get(split[1])+1);
            }else{
                map.put(split[1],1);
            }
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey()+ "的个数为:"+ entry.getValue());
        }
    }
}
